Skip to content

Avoid non-immutable map_ptr indirection - #7394

Closed
dstogov wants to merge 1 commit into
php:masterfrom
dstogov:map_ptr
Closed

Avoid non-immutable map_ptr indirection#7394
dstogov wants to merge 1 commit into
php:masterfrom
dstogov:map_ptr

Conversation

@dstogov

@dstogov dstogov commented Aug 24, 2021

Copy link
Copy Markdown
Member

No description provided.

@nikic

nikic commented Aug 24, 2021

Copy link
Copy Markdown
Member

This extra patch mostly fixes closure support: https://gist.github.com/nikic/898f766722839d27a9d599f653c80a8c

However, there is a problem: For fake closures we want to share static variables between the function and the closure. However, the closure has a separate copy of the function. Without the indirection pointer, they will now have two independent static_variables pointers.

@nikic nikic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, let's land this after PHP-8.1 has been branched off.

@krakjoe krakjoe added this to the PHP 8.2 milestone Aug 31, 2021
@cmb69

cmb69 commented Sep 14, 2021

Copy link
Copy Markdown
Member

As discussed, let's land this after PHP-8.1 has been branched off.

What happened two weeks ago. :)

@nikic

nikic commented Oct 13, 2021

Copy link
Copy Markdown
Member

Do you plan to merge this?

@dstogov

dstogov commented Oct 13, 2021

Copy link
Copy Markdown
Member Author

Do you plan to merge this?

I already forgot about this. I'll need to fix merge conflicts first. I'll do this when have more time.

@dstogov

dstogov commented Oct 13, 2021

Copy link
Copy Markdown
Member Author

@nikic could you please make a quick review once again

ZEND_ASSERT(op_array->fn_flags & ZEND_ACC_HEAP_RT_CACHE);
void *ptr = emalloc(op_array->cache_size + sizeof(void*));
void *ptr = emalloc(op_array->cache_size);
char *run_time_cache = ptr;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can drop the ptr variable here and use only run_time_cache.

@dstogov

dstogov commented Oct 14, 2021

Copy link
Copy Markdown
Member Author

Merged via ddaf64b

@dstogov dstogov closed this Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants